//
//  UIBarButtonItem+DSSealBarButtonItem.m
//  项目A_百思不得姐
//
//  Created by wudongyang on 16/5/17.
//  Copyright © 2016年 wudongyang. All rights reserved.
//

#import "UIBarButtonItem+DSSealBarButtonItem.h"
//#import "UIView+DSSealFrame.h"
@implementation UIBarButtonItem (DSSealBarButtonItem)

// 参数1:正常图片 参数2:高亮图片 参数3:谁调用 参数4:执行方法
+ (instancetype)itemWithImage:(NSString *)image highImage:(NSString *)highImage target:(id)target action:(SEL)action{
    
    UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
    [button setBackgroundImage:[UIImage imageNamed:image] forState:UIControlStateNormal];
    [button setBackgroundImage:[UIImage imageNamed:highImage] forState:UIControlStateHighlighted];
//    button.size = button.currentBackgroundImage.size;
    button.frame = CGRectMake(0, 0, button.currentBackgroundImage.size.width, button.currentBackgroundImage.size.height);
    
    [button addTarget:target action:action forControlEvents:UIControlEventTouchUpInside];
    
    return [[self alloc] initWithCustomView:button];
}
@end
